// base64图片上传
export function UploadBase64File (base64, data) {
  const arr = base64.split(',')
  const code = arr[1]
  let bytes = window.atob(code)
  let Uint8 = new Uint8Array(bytes.length)
  for (let i = 0; i < bytes.length; i++) {
    Uint8[i] = bytes.charCodeAt(i)
  }
  let fileName = 'sign' + new Date().getTime() + '.' + arr[0].split('/')[1].split(';')[0]
  // ie兼容
  let files = window.ActiveXObject || 'ActiveXObject' in window ? new Blob([Uint8], {type: 'image/png', endings: 'transparent'}) : new File([Uint8], fileName, {})
  var formData = new FormData()
  formData.append('file', files, fileName)
  // 设置文件上传需要的参数
  formData.append('data', JSON.stringify({data}))
  return formData
}
